# Title     : TODO
# Objective : TODO
# Created by: Administrator
# Created on: 2019/7/24

library(ggrepel)
library(ropls)
library(pROC)
library(egg)
library(stringr)
library(randomForest)
library(Boruta)
library(magrittr)
library(optparse)
library(tidyverse)

option_list <- list(
make_option("--g", default = "SampleInfo.csv", type = "character", help = "sample group file"),
make_option("--sc", default = "sample_color.txt", type = "character", help = "sample color file"),
make_option("--config", default = "config.csv", type = "character", help = "config file")
)
opt <- parse_args(OptionParser(option_list = option_list))

options(digits = 3)

configData <- read.csv(opt$config, header = F, stringsAsFactors = F) %>%
    set_colnames(c("arg", "value")) %>%
    column_to_rownames("arg")

configData

svmTop <- configData["svmTop", "value"] %>%
as.numeric()

fileName<-"SVM_Imp_Rank.csv"

if(!file.exists(fileName)){
    quit(status = 0)
}

data <- read_csv(fileName) %>%
slice(1 : svmTop)
write_csv(data, str_c("SVM_Top", svmTop, "_Imp_Rank.csv"))












